﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeiXinSDK.MP.Model
{
	public class MediaUploadResponeModel : ResponseModel
	{
		[JsonProperty("type")]
		public string Type { get; set; }

		[JsonProperty("media_id")]
		public string MediaID { get; set; }

		[JsonProperty("created_at")]
		private long created_at { get; set; }

		public DateTime CreatedAt { get { return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(created_at); } }
	}

	public class MediaFileModel : ResponseModel
	{
		public byte[] File { get; set; }
	}

	public class NewsMaterialModel
	{
		[JsonProperty("articles")]
		public IEnumerable<NewsItem> Articles { get; set; }

		public class NewsItem
		{
			[JsonProperty("title")]
			public string Title { get; set; }

			[JsonProperty("thumb_media_id")]
			public string ThumbMediaId { get; set; }

			[JsonProperty("author")]
			public string Author { get; set; }

			[JsonProperty("digest")]
			public string Digest { get; set; }

			/// <summary> 是否显示封面，0为false，即不显示，1为true，即显示 </summary>
			[JsonProperty("show_cover_pic")]
			public int ShowCoverPic { get; set; }

			/// <summary> 图文消息的具体内容，支持HTML标签，必须少于2万字符，小于1M，且此处会去除JS </summary>
			[JsonProperty("content")]
			public string Content { get; set; }

			/// <summary> 图文消息的原文地址，即点击“阅读原文”后的URL </summary>
			[JsonProperty("content_source_url")]
			public string ContentSourceUrl { get; set; }
		}
	}

	public class AddMaterialResponseModel : ResponseModel
	{
		[JsonProperty("media_id")]
		public string MediaID { get; set; }

	}

	public class GetMaterialResponseModel : ResponseModel
	{

	}
}
